home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 December / PCWDEC06.iso / Software / Trial / Paint Shop Pro XI / Data1.cab / _BAA09DC7AAA246AA9CDE897A892EAD4B < prev    next >
Encoding:
Text File  |  2006-08-04  |  15.9 KB  |  417 lines

  1. from PSPApp import *
  2.  
  3. # Copyright 2006 Corel Software Inc., all rights reserved
  4. # This file contains utility routines provided by Corel Software.
  5. # This file contains all translatable strings for the bundled script files.
  6.  
  7. ScriptData = {}
  8.  
  9. class SaveSelection:
  10.     ''' define a helper class that can save any active selection to the alpha
  11.         channel and restore it later
  12.     '''
  13.     def __init__( self, Environment, Doc ):
  14.         ''' at init time we save the environment variable provided by PSP,
  15.             and if a selection exists we save it to an alpha channel
  16.         '''
  17.         self.Env = Environment
  18.         self.SavedSelection =  '__$TempSavedSelection$__'
  19.         self.IsSaved = 0
  20.         self.SavedOnDoc = Doc
  21.         
  22.         SelResult = App.Do( self.Env, 'GetRasterSelectionRect' )
  23.         if SelResult[ 'Type' ] != App.Constants.SelectionType.None:
  24.             # if there is a selection save it to the alpha channel
  25.             App.Do( self.Env, 'SelectSaveDisk', {
  26.                 'FileName': self.SavedSelection, 
  27.                 'Overwrite': App.Constants.Boolean.true, 
  28.                 'GeneralSettings': {
  29.                     'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  30.                     'AutoActionMode': App.Constants.AutoActionMode.Match
  31.                     }
  32.                 }, Doc)
  33.             self.IsSaved = 1    # set this so we know we saved one
  34.             
  35.             if SelResult[ 'Type' ] == App.Constants.SelectionType.Floating:
  36.                 # if the selection is floating promote it to a layer
  37.                 App.Do( self.Env, 'SelectPromote', {
  38.                         'KeepSelection': App.Constants.Boolean.false, 
  39.                         'LayerName': SelectionLayer, 
  40.                         'GeneralSettings': {
  41.                             'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  42.                             'AutoActionMode': App.Constants.AutoActionMode.Match
  43.                             }
  44.                         }, Doc)
  45.             else:
  46.                 App.Do( self.Env, 'SelectNone' )
  47.            
  48.             
  49.     def RestoreSelection( self ):
  50.         ''' if we have saved a selection, restore it now.  If we promoted
  51.             a floating selection to a layer we don't restore the selection
  52.             but don't attempt to mess with the layer in any way
  53.         '''
  54.         if self.IsSaved == 1:
  55.             # load the selection back from disk - this will replace any existing selection
  56.             App.Do( self.Env, 'SelectLoadDisk', {
  57.                     'FileName': self.SavedSelection, 
  58.                     'Operation': App.Constants.SelectionOperation.Replace, 
  59.                     'UpperLeft': App.Constants.Boolean.false, 
  60.                     'ClipToCanvas': App.Constants.Boolean.false, 
  61.                     'GreyMethod': App.Constants.CreateMaskFrom.Luminance, 
  62.                     'Invert': App.Constants.Boolean.false, 
  63.                     'GeneralSettings': {
  64.                         'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  65.                         'AutoActionMode': App.Constants.AutoActionMode.Match
  66.                         }
  67.                     }, self.SavedOnDoc)
  68.  
  69.     # end class SaveSelection
  70.  
  71. def NameFromMaterial( Material, Delimiter=' ', IncludeTexture=1 ):
  72.     ''' Given a material repository, return a name that describes it.
  73.         By default the name is delimited with space, but the delimiter
  74.         parameter can be used to override it.
  75.         By default textures are included in the name, but can be omitted
  76.         by setting the IncludeTexture parameter to 0
  77.     '''
  78.     TextureName = None
  79.     TypeName = ''
  80.     if Material is None:
  81.         CoreName = Null
  82.     else:
  83.         if Material[ 'Pattern' ] and \
  84.            (Material[ 'Pattern' ][ 'Name' ] or Material[ 'Pattern' ][ 'Image' ] ):
  85.             TypeName = Pattern
  86.             if Material[ 'Pattern' ][ 'Name' ]:
  87.                 CoreName = Material[ 'Pattern'  ][ 'Name' ]
  88.             else:
  89.                 CoreName = Inline
  90.         elif Material[ 'Gradient' ] and Material[ 'Gradient' ][ 'Name' ]:
  91.             TypeName = Gradient
  92.             GradType = {}
  93.             GradType[ App.Constants.GradientType.Linear ] = Linear
  94.             GradType[ App.Constants.GradientType.Rectangular ] = Rectangular
  95.             GradType[ App.Constants.GradientType.Radial ] = Radial
  96.             GradType[ App.Constants.GradientType.Angular ] = Sunburst
  97.             
  98.             CoreName = '%s%s%s' % ( Material[ 'Gradient' ][ 'Name' ], Delimiter, 
  99.                                     GradType[ Material[ 'Gradient' ][ 'GradientType' ] ] )
  100.         elif Material[ 'Art' ]:
  101.             TypeName = Art
  102.             CoreName = '%02x%02x%02x' % Material[ 'Art' ][ 'Color' ]
  103.         else:
  104.             TypeName = Solid
  105.             CoreName = '%02x%02x%02x' % Material[ 'Color' ]
  106.  
  107.         if Material[ 'Texture' ] and Material[ 'Texture' ][ 'Name' ]:
  108.             TextureName = Material[ 'Texture' ]['Name']
  109.  
  110.     if TextureName is not None and IncludeTexture != 0:
  111.         MaterialName = '%s%s%s%s%s' % ( TypeName, Delimiter, CoreName, Delimiter, TextureName )
  112.     else:
  113.         MaterialName = '%s%s%s' % ( TypeName, Delimiter, CoreName )
  114.  
  115.     return MaterialName
  116.  
  117. def IsNullMaterial( Material ):
  118.     ' check if the passed in material is none.  Returns true if null, false if non-null'
  119.     if Material is None:    
  120.         return App.Constants.Boolean.true   # material might be entirely none
  121.  
  122.     ArtIsNone = 0
  123.     ColorIsNone = 0
  124.     GradientIsNone = 0
  125.     PatternIsNone = 0
  126.     
  127.     if Material['Color'] is None:
  128.         ColorIsNone = 1
  129.  
  130.     if Material['Gradient'] is None or Material['Gradient']['Name'] is None:
  131.         GradientIsNone = 1
  132.  
  133.     if Material['Pattern'] is None or \
  134.        (Material['Pattern']['Name'] is None and Material['Pattern']['Image'] is None):
  135.         PatternIsNone = 1
  136.  
  137.     if Material['Art'] is None:
  138.         ArtIsNone = 1
  139.  
  140.     if ColorIsNone and GradientIsNone and PatternIsNone and ArtIsNone:
  141.         return App.Constants.Boolean.true   #it works out to none
  142.     else:
  143.         return App.Constants.Boolean.false
  144.  
  145.  
  146. def IsFlatImage( Environment, Doc ):
  147.     'Determine if Doc consists of a single background layer.  True if flat, false if not'
  148.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  149.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  150.  
  151.     if ImageInfo[ 'LayerNum' ] == 1 and LayerInfo[ 'IsBackground' ] == App.Constants.Boolean.true:
  152.         return App.Constants.Boolean.true
  153.     else:
  154.         return App.Constants.Boolean.false
  155.  
  156. def IsPaletted( Environment, Doc ):
  157.     '''Determine if the current image is paletted.  Greyscale is not counted as paletted
  158.        Returns true on paletted, false if not
  159.     '''
  160.     # these are all the paletted pixel formats
  161.     TargetFormats = [ App.Constants.PixelFormat.Index1, App.Constants.PixelFormat.Index4,
  162.                       App.Constants.PixelFormat.Index8 ]
  163.     
  164.     # are we paletted?
  165.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  166.  
  167.     if Info['PixelFormat'] in TargetFormats:
  168.         return App.Constants.Boolean.true
  169.     else:
  170.         return App.Constants.Boolean.false
  171.  
  172. def IsTrueColor( Environment, Doc ):
  173.     ''' Determine if the current image is true color.  Greyscale does not count
  174.         Returns true for true color, false for all others
  175.     '''
  176.     TargetFormats = [ App.Constants.PixelFormat.BGR, App.Constants.PixelFormat.BGRA ]
  177.     
  178.     # are we true color?
  179.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  180.     if Info['PixelFormat'] in TargetFormats:
  181.         return App.Constants.Boolean.true
  182.     else:
  183.         return App.Constants.Boolean.false
  184.  
  185. def IsGreyScale( Environment, Doc ):
  186.     ' Determine if the current image (not layer) is greyscale. True if it is, false otherwise'
  187.     TargetFormats = [ App.Constants.PixelFormat.Grey, App.Constants.PixelFormat.GreyA ]
  188.     
  189.     # are we true color?
  190.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  191.     if Info['PixelFormat'] in TargetFormats:
  192.         return App.Constants.Boolean.true
  193.     else:
  194.         return App.Constants.Boolean.false
  195.  
  196. def LayerIsArtMedia( Environment, Doc ):
  197.     'Returns true if the current layer is a artmedia layer'
  198.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  199.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.ArtMedia:
  200.         return App.Constants.Boolean.true
  201.     else:
  202.         return App.Constants.Boolean.false
  203.  
  204. def LayerIsRaster( Environment, Doc ):
  205.     'Returns true if the current layer is a raster layer'
  206.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  207.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Raster:
  208.         return App.Constants.Boolean.true
  209.     else:
  210.         return App.Constants.Boolean.false
  211.  
  212.  
  213. def LayerIsVector( Environment, Doc ):
  214.     'Returns true if the current layer is a vector layer'
  215.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  216.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Vector:
  217.         return App.Constants.Boolean.true
  218.     else:
  219.         return App.Constants.Boolean.false
  220.  
  221. def LayerIsBackground( Environment, Doc ):
  222.     'Returns true if the current layer is the background layer'
  223.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  224.     return LayerInfo[ 'IsBackground' ]
  225.     
  226.  
  227. def GetLayerCount( Environment, Doc ):
  228.     'Returns number of layers in Doc'
  229.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  230.     return ImageInfo[ 'LayerNum' ]    
  231.  
  232. def GetCurrentLayerName( Environment, Doc ):
  233.     'Returns the name of the current layer in Doc'
  234.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  235.     return LayerInfo[ 'General' ][ 'Name' ]
  236.  
  237. def PromoteToTrueColor( Environment, Doc ):
  238.     'If the current image type is paletted, promote it to true color.  Greyscale is left alone'
  239.     if IsPaletted( Environment, Doc ):
  240.         App.Do( Environment, 'IncreaseColorsTo16Million', {}, Doc )
  241.     return
  242.  
  243. def RequireADoc( Environment ):
  244.     '''Test that we actually have a target document, and put up a message box if we dont
  245.        Returns true if we have an open doc, false otherwise
  246.     '''
  247.     if App.TargetDocument is None:
  248.         App.Do( Environment, 'MsgBox', {
  249.                 'Buttons': App.Constants.MsgButtons.OK, 
  250.                 'Icon': App.Constants.MsgIcons.Stop, 
  251.                 'Text': RequiresOpenImage, 
  252.                 })
  253.         return App.Constants.Boolean.false
  254.     else:
  255.         return App.Constants.Boolean.true
  256.  
  257. # Begin Translatable Strings
  258. # BevelSelection.PspScript:
  259. LayerName_BevelSelection = u"SΘlection biseautΘe"
  260.  
  261. # Black and white pencil.PspScript:
  262. LayerName_Blackandwhitepencil = u"Raster 2"
  263.  
  264. # Border with drop shadow.PspScript:
  265. AlphaName = u"Selection #1"
  266.  
  267. # Flag.PspScript:
  268. #AlphaName = u"Selection #1"
  269.  
  270. # Grey chart.PspScript:
  271. GradientName = u"Premier plan/ArriΦre-plan"
  272.  
  273. # Sloppy edges.PspScript:
  274. #AlphaName = u"Selection #1"
  275.  
  276. # Toned greyscale.PspScript:
  277. LayerName_Tonedgreyscale = u"╔quilibre des couleurs 1"
  278.  
  279. # Vignette.PspScript:
  280. LayerName_Vignette = u"Raster 2"
  281.  
  282. # Photo edges.PspScript:
  283. LayerName_Photoedges = u"Raster 2"
  284.  
  285. # SimpleCaption.PspScript:
  286. ImageTooSmallMsg = u"L'image actuelle est trop petite pour permettre l'ajout d'une lΘgendeá; elle doit Ωtre d'au moins 200áxá200."
  287. MultipleLayersMsg = u"L'image actuelle comporte de multiples calques. Cela peut conduire α des rΘsultats inattendus.\nNous vous conseillons d'aplatir l'image avant de poursuivre. Voulez-vous l'aplatir ?"
  288. CaptionPrompt = u"Entrez une lΘgende pour l'image. Elle sera centrΘe sous l'image."
  289. CaptionTitle = u"Entrez la lΘgende de l'image"
  290. PromotedLayerName = u"Image"
  291. PageSurfaceLayerName = u"Surface de la page"
  292. AlbumPageLayerGroup = u"Page d'album"
  293. DropShadowLayerName = u"Ombre portΘe"
  294. CaptionTextLayerName = u"Texte de la lΘgende"
  295. CaptionFontName2 = u"Tahoma" 
  296.  
  297. # VectorMergeAndCutoutSelected.PspScript:
  298. TwoOrMoreMsg = u"Ce script requiert la sΘlection d'au moins deux objets vectoriels." 
  299.  
  300. # VectorMergeSelected.PspScript:
  301. #TwoOrMoreMsg = u"This script requires that two or more vector objects be selected."
  302.  
  303. # AddPSP8FileLocations.PspScript:
  304. NoPSP8FoldersFound = u"Aucun dossier de PSP8 n'a ΘtΘ trouvΘ."
  305. FilesHaveBeenAdded = u"Les fichiers dans '%s' ont ΘtΘ ajoutΘs aux prΘfΘrences d'emplacements de fichiers."
  306. Brushes = u"Pinceaux"
  307. BumpMaps = u"Reliefs et textures"
  308. DeformationMaps = u"ParamΦtres de dΘformation"
  309. DisplacementMaps = u"ParamΦtres de dΘplacement"
  310. EnvironmentMaps = u"ParamΦtres d'environnement"
  311. Gradients = u"DΘgradΘs"
  312. Masks = u"Masques"
  313. Palettes = u"Palettes"
  314. Patterns = u"Motifs"
  315. PictureFrames = u"Cadres"
  316. PictureTubes = u"Tubes α images"
  317. PresetShapes = u"Formes"
  318. Presets = u"Options"
  319. PrintTemplates = u"ModΦles de compositions"
  320. QuickGuides = u"Guides rapides"
  321. SampleImages = u"Exemples d'images"
  322. ScriptsRestricted = u"Scripts - RΘglementΘs"
  323. ScriptsTrusted = u"Scripts - SΘcurisΘs"
  324. Selections = u"SΘlections"
  325. StyledLines = u"Styles personnalisΘs"
  326. Swatches = u"╔chantillons"
  327. Textures = u"Textures"
  328.  
  329. # AddPSP8FileLocationsALL.PspScript:
  330. #NoPSP8FoldersFound = u"No PSP8 folders found."
  331. #FilesHaveBeenAdded = u"Files in '%s' have been added to the File Locations preferences."
  332. #Brushes = u"Brushes"
  333. #BumpMaps = u"Bump Maps"
  334. #DeformationMaps = u"Deformation Maps"
  335. #DisplacementMaps = u"Displacement Maps"
  336. #EnvironmentMaps = u"Environment Maps"
  337. #Gradients = u"Gradients"
  338. #Masks = u"Masks"
  339. #Palettes = u"Palettes"
  340. #Patterns = u"Patterns"
  341. #PictureFrames = u"Picture Frames"
  342. #PictureTubes = u"Picture Tubes"
  343. #PresetShapes = u"Preset Shapes"
  344. #Presets = u"Presets"
  345. #PrintTemplates = u"Print Templates"
  346. #QuickGuides = u"Quick Guides"
  347. #SampleImages = u"Sample Images"
  348. #ScriptsRestricted = u"Scripts-Restricted"
  349. #ScriptsTrusted = u"Scripts-Trusted"
  350. #Selections = u"Selections"
  351. #StyledLines = u"Styled Lines"
  352. #Swatches = u"Swatches"
  353. #Textures = u"Textures"
  354.  
  355. # CapturePalette.PspScript:
  356. RequiresPaletted = u"Ce script requiert une image avec palette. Voulez-vous rΘduire le nombre de couleursá?"
  357. NoPaletteFound = u"Erreur interneá: Aucune palette n'a ΘtΘ trouvΘe"
  358. GroutWidthMsg = u"La valeur GroutWidth doit Ωtre comprise entre 0 et 20"
  359. ColorsPerRowMsg = u"La valeur ColorsPerRow doit Ωtre comprise entre 1 et 100"
  360. TileSizeMsg = u"La valeur TileSize doit Ωtre comprise entre 2 et 50"
  361. NumColorsMsg = u"Le nombre de couleurs doit Ωtre compris entre 2 et 1024"
  362. ButtonMarginMsg = u"La valeur de ButtonMargin doit Ωtre infΘrieure α la moitiΘ de TileSize"
  363. ColorIs = u"La couleur %d est (%02X,%02X,%02X)"
  364.  
  365. # EXIFCaptioning.PspScript:
  366. NoEXIFData = u"Aucun donnΘe EXIF n'a ΘtΘ trouvΘe sur l'image actuelle."
  367. ExposureMsg = u"ouverture f/%g, exposition %s"
  368. CaptionBackground = u"ArriΦre-plan de la lΘgende"
  369. EXIFCaption = u"LΘgende EXIF"
  370. EXIFText = u"Texte EXIF"
  371. CaptionFontName = u"Arial"
  372.  
  373. # SplitCMYKtoLayerGroup.PspScript:
  374. Black = u"Noir"
  375. BlackChannel = u"Canal du noir"
  376. Yellow = u"Jaune"
  377. YellowChannel = u"Canal du jaune"
  378. Magenta = u"Magenta"
  379. MagentaChannel = u"Canal du magenta"
  380. Cyan = u"Cyan"
  381. CyanChannel = u"Canal du cyan"
  382. CMYKChannels = u"Canaux CMJN"
  383.  
  384. # SplitHSLtoLayerGroup.PspScript:
  385. Lightness = u"LuminositΘ"
  386. LightnessChannel = u"Canal de la luminositΘ"
  387. Saturation = u"Saturation"
  388. SaturationChannel = u"Canal de la saturation"
  389. Hue = u"Teinte"
  390. HueChannel = u"Canal de la teinte"
  391. HSLChannels = u"Canaux TSL"
  392.  
  393. # SplitRGBtoLayerGroup.PspScript:
  394. Blue = u"Bleu"
  395. BlueChannel = u"Canal du bleu"
  396. Green = u"Vert"
  397. GreenChannel = u"Canal du vert"
  398. Red = u"Rouge"
  399. RedChannel = u"Canal du rouge"
  400. RGBChannels = u"Canaux RVB"
  401.  
  402. # JascUtils.py, PSPUtils.py
  403. SelectionLayer = u"SΘlection transformΘe via un script"
  404. Pattern = u"Motif"
  405. Inline = u"En ligne"
  406. Gradient = u"DΘgradΘ"
  407. Linear = u"LinΘaire"
  408. Radial = u"Radial"
  409. Rectangular = u"Rectangulaire"
  410. Sunburst = u"Halo"
  411. Solid = u"Plein"
  412. Null = u"Nul"
  413. Art = u"Art"
  414. RequiresOpenImage = u"Ce script requiert une image ouverte."
  415. # End Translatable Strings
  416.  
  417.